* balance the treatment and control groups -------------------------------------

ebalance treatment recruitment_pool treatment_nonterror casualty_district       ///
kurdish_district akp_district higher_education min_margin turnout_jun,          ///
targets(1)

* run the regressions models and save them to memory ---------------------------

svyset [pweight= _webal]
eststo: svy: reg chp_nov treatment treatment_multi chp_jun
eststo: svy: reg mhp_nov treatment treatment_multi mhp_jun
eststo: svy: reg hdp_nov treatment treatment_multi hdp_jun
eststo: svy: reg rw_nov treatment treatment_multi rw_jun

* print the results ------------------------------------------------------------

esttab,                                                                         ///
replace se b(3) se(3) stats(N r2) label nodepvars nonotes nomtitles             ///
mlabels(CHP MHP HDP RW)                                                         ///
order(treatment treatment_multi)                                                ///
rename(chp_jun "Pre-test" mhp_jun "Pre-test" hdp_jun "Pre-test"                 ///
rw_jun "Pre-test")                                                              ///
title("Table S17: Regression models of non-government party vote share, based on entropy balancing")

* save the results -------------------------------------------------------------

esttab using "./tables/table_s17.tex",                                          ///
replace se b(3) se(3) stats(N r2) label nodepvars nonotes nomtitles             ///
mlabels(CHP MHP HDP RW)                                                         ///
order(treatment treatment_multi)                                                ///
rename(chp_jun "Pre-test" mhp_jun "Pre-test" hdp_jun "Pre-test"                 ///
rw_jun "Pre-test")                                                              ///
title("Regression models of non-government party vote share, based on entropy balancing")

* remove the entropy balancing weights -----------------------------------------

drop _webal

* remove the models from memory ------------------------------------------------

eststo clear